package day05;

import java.util.Scanner;

//随机加法运算器
public class Addition {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int score = 0;//总分
        for (int i = 1; i <= 10; i++) {
            //1)出题  2)答题    3)判题
            //出题
            int a = (int)(Math.random()*100+1); //设置随机数为1-100
            int b = (int)(Math.random()*100+1);
            int result = a + b;
            System.out.println("("+i+")"+a+"+"+b+"=?");
            //答题
            System.out.println("开始答题吧!");
            int answer = scan.nextInt();
            //判题
            if (answer == result) {
                System.out.println("恭喜您答对啦");
                score += 10;
            }else {
                System.out.println("答出错了呢");
            }
        }
        System.out.println('\n');
        System.out.println("恭喜您,总成绩为:"+score);
    }
}
